package Dlgs;

import java.util.Calendar;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;

import Callbacks.PromptCallback;
import Enums.Cask;
import Enums.EquipType;
import Enums.LabResult;
import Enums.MashType;
import Enums.PitchType;
import Enums.PromptType;
import Enums.Units;
import Models.AllocationTemplate;
import Models.Brew;
import Models.BrewView;
import Models.Brinks;
import Models.Customer;
import Models.CustomerGroup;
import Models.CustomerView;
import Models.DiscountCode;
import Models.Equipment;
import Models.FGI;
import Models.FGIView;
import Models.Hops;
import Models.LabProcess;
import Models.LabType;
import Models.Malt;
import Models.POSSupplyView;
import Models.PackageType;
import Models.Supplies;
import Models.VesselCleaningProcedure;
import Models.Warehouse;
import Models.WaterSalts;
import Models.Yeast;
import Models.YeastGen;
import Models.YeastView;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.text.InputType;
import android.util.SparseBooleanArray;
import android.widget.ArrayAdapter;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.TimePicker;

public class PromptDialog {
	
	@SuppressWarnings("rawtypes")
	PromptCallback callback;
	
	@SuppressWarnings("rawtypes")
	public PromptDialog(PromptCallback callback){
		this.callback = callback;
	}
	
	//General item prompts double, int, string, etc.
	public void promptDouble(final String title, final String body, final Context context, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final EditText floatInput = new EditText(context);
		builder.setView(floatInput);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				double val = Double.parseDouble(floatInput.getText().toString().trim());
				callback.promptCallback(null, val, 0, "", type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptInt(final String title, final String body, final Context context, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final EditText intInput = new EditText(context);
		builder.setView(intInput);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				int val = Integer.parseInt(intInput.getText().toString().trim());
				callback.promptCallback(null, 0, val, "", type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptIntPreset(final String title, final String body
			, final Context context, final PromptType type, final int num){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final EditText intInput = new EditText(context);
		intInput.setText(Integer.toString(num));
		builder.setView(intInput);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				int val = Integer.parseInt(intInput.getText().toString().trim());
				callback.promptCallback(null, 0, val, "", type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptString(final String title, final String body, final Context context, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final EditText text = new EditText(context);
		//text.setInputType(InputType.TYPE_CLASS_TEXT);
		builder.setView(text);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				callback.promptCallback(null, 0, 0, text.getText().toString(), type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptDate(final String title, final String body, final Context context,
			final Date date, final PromptType type, final boolean displayCal){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		
		final DatePicker datePicker = new DatePicker(context);
		datePicker.updateDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
		datePicker.setCalendarViewShown(displayCal);
		builder.setView(datePicker);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				Calendar newCal = Calendar.getInstance();
				newCal.set(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth());
				Date newDate = newCal.getTime();
				callback.promptCallback(newDate, 0, 0, "", type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptTime(final String title, final String body, final Context context,
			final Date date, final PromptType type, final boolean displayCal){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		
		final TimePicker timePicker = new TimePicker(context);
		timePicker.setCurrentHour(cal.get(Calendar.HOUR_OF_DAY));
		timePicker.setCurrentMinute(cal.get(Calendar.MINUTE));
		timePicker.setIs24HourView(true);
		//timePicker.setCalendarViewShown(displayCal);
		builder.setView(timePicker);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				Calendar newCal = Calendar.getInstance();
				newCal.set(Calendar.HOUR_OF_DAY, timePicker.getCurrentHour());
				newCal.set(Calendar.MINUTE, timePicker.getCurrentMinute());
				Date newDate = newCal.getTime();
				callback.promptCallback(newDate, 0, 0, "", type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptYesNo(final String title, final String body, final Context context, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				callback.promptCallback(null, 0, 0, "", type);
			}
		});

		builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	//Specialty Class prompts.
	public void promptDiscountCode(final String title, final String body, final Context context
			, final ArrayList<DiscountCode> discountCodes, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final DiscountCode discount : discountCodes){
			list.add(discount.getDisplayString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final DiscountCode dc : discountCodes){
					if(dc.getDisplayString().equals(str)){
						callback.promptCallback(dc, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptFGI(final String title, final String body, final Context context
			, final ArrayList<FGI> fgis, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final FGI fgi : fgis){
			list.add(fgi.getDisplayString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final FGI fgi : fgis){
					if(fgi.getDisplayString().equals(str)){
						callback.promptCallback(fgi, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptFGIView(final String title, final String body, final Context context
			, final ArrayList<FGIView> fgis, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final FGIView fgi : fgis){
			list.add(fgi.getDisplay());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final FGIView fgi : fgis){
					if(fgi.getDisplay().equals(str)){
						callback.promptCallback(fgi, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptWarehouse(final String title, final String body, final Context context
			, final ArrayList<Warehouse> warehouses, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final Warehouse warehouse : warehouses){
			list.add(warehouse.getDisplayString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final Warehouse warehouse : warehouses){
					if(warehouse.getDisplayString().equals(str)){
						callback.promptCallback(warehouse, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptWaterSalt(final String title, final String body, final Context context
			, final ArrayList<WaterSalts> waterSalts, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final WaterSalts ws : waterSalts){
			list.add(ws.getDescriptionString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final WaterSalts ws : waterSalts){
					if(ws.getDescriptionString().equals(str)){
						callback.promptCallback(ws, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptSupply(final String title, final String body, final Context context
			, final ArrayList<Supplies> supplies, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final Supplies supply : supplies){
			list.add(supply.getDisplay());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final Supplies supply : supplies){
					if(supply.getDisplay().equals(str)){
						callback.promptCallback(supply, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptYeast(final String title, final String body, final Context context
			, final ArrayList<Yeast> yeast, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final Yeast y : yeast){
			list.add(y.getYeastName());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final Yeast y : yeast){
					if(y.getYeastName().equals(str)){
						callback.promptCallback(y, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptBrew(final String title, final String body, final Context context
			, final ArrayList<Brew> brews, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final Brew b : brews){
			list.add(b.getDisplayString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final Brew b : brews){
					if(b.getDisplayString().equals(str)){
						callback.promptCallback(b, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptBrink(final String title, final String body, final Context context
			, final ArrayList<Brinks> brinks, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final Brinks b : brinks){
			list.add(b.getBrinkDescription());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final Brinks b : brinks){
					if(b.getBrinkDescription().equals(str)){
						callback.promptCallback(b, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptSupplyView(final String title, final String body, final Context context
			, final ArrayList<POSSupplyView> supplies, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final POSSupplyView supply : supplies){
			list.add(supply.getDisplayString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final POSSupplyView supply : supplies){
					if(supply.getDisplayString().equals(str)){
						callback.promptCallback(supply, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptMalt(final String title, final String body, final Context context
			, final ArrayList<Malt> malts, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final Malt malt : malts){
			list.add(malt.getMaltName());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final Malt malt : malts){
					if(malt.getMaltName().equals(str)){
						callback.promptCallback(malt, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptHop(final String title, final String body, final Context context
			, final ArrayList<Hops> hops, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final Hops hop : hops){
			list.add(hop.getHopName());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final Hops hop : hops){
					if(hop.getHopName().equals(str)){
						callback.promptCallback(hop, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptPackages(final String title, final String body, final Context context
			, final ArrayList<PackageType> packageTypes, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final ListView spinner = new ListView(context);
		
		List<String> list = new ArrayList<String>();
		for(final PackageType pt : packageTypes){
			list.add(pt.getDisplayString());
		}
		
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_list_item_multiple_choice, list);
		spinner.setAdapter(dataAdapter);
		spinner.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {

				List<PackageType> items = new ArrayList<PackageType>();
				SparseBooleanArray checked = spinner.getCheckedItemPositions();
				for(int i=0; i < spinner.getCount(); i++){
					if(checked.get(i)){
						final String cmpStr = spinner.getItemAtPosition(i).toString();
						for(final PackageType pt : packageTypes){
							if(pt.getDisplayString().equals(cmpStr)){
								items.add(pt);
							}
						}
					}
				}
				callback.promptCallback(items, 0, 0, "", type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptLabProcess(final String title, final String body, final Context context
			, final ArrayList<LabProcess> labProcesses, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final LabProcess lp : labProcesses){
			list.add(lp.getLpDescription());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final LabProcess lp : labProcesses){
					if(lp.getLpDescription().equals(str)){
						callback.promptCallback(lp, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptLabType(final String title, final String body, final Context context
			, final ArrayList<LabType> labTypes, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final LabType lt : labTypes){
			list.add(lt.getLtDescription());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final LabType lt : labTypes){
					if(lt.getLtDescription().equals(str)){
						callback.promptCallback(lt, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptCustomerView(final String title, final String body, final Context context
			, final ArrayList<CustomerView> customers, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final CustomerView customer : customers){
			list.add(customer.getName());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final CustomerView customer : customers){
					if(customer.getName().equals(str)){
						callback.promptCallback(customer, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptBrewView(final String title, final String body, final Context context
			, final ArrayList<BrewView> brews, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final BrewView brew : brews){
			list.add(brew.getDisplayString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final BrewView brew : brews){
					if(brew.getDisplayString().equals(str)){
						callback.promptCallback(brew, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptCustomer(final String title, final String body, final Context context
			, final ArrayList<Customer> customers, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final Customer customer : customers){
			list.add(customer.getName());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final Customer customer : customers){
					if(customer.getName().equals(str)){
						callback.promptCallback(customer, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptCustomerGroup(final String title, final String body, final Context context
			, final ArrayList<CustomerGroup> customers, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final CustomerGroup customer : customers){
			list.add(customer.getDisplayString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final CustomerGroup customer : customers){
					if(customer.getDisplayString().equals(str)){
						callback.promptCallback(customer, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptVCP(final String title, final String body, final Context context
			, final ArrayList<VesselCleaningProcedure> vcps, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final VesselCleaningProcedure vcp : vcps){
			list.add(vcp.getDisplayString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final VesselCleaningProcedure vcp : vcps){
					if(vcp.getDisplayString().equals(str)){
						callback.promptCallback(vcp, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	//Specialty Class prompts.
	public void promptAllocationTemplate(final String title, final String body, final Context context
			, final ArrayList<AllocationTemplate> templates, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final AllocationTemplate at : templates){
			list.add(at.getaTempDesc());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final AllocationTemplate at : templates){
					if(at.getaTempDesc().equals(str)){
						callback.promptCallback(at, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptEquipment(final String title, final String body, final Context context
			, final ArrayList<Equipment> equipment, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final Equipment eq : equipment){
			list.add(eq.getDisplayName());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final Equipment eq : equipment){
					if(eq.getDisplayName().equals(str)){
						callback.promptCallback(eq, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptYeastView(final String title, final String body, final Context context
			, final ArrayList<YeastView> items, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final YeastView item : items){
			list.add(item.getYeastName());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final YeastView item : items){
					if(item.getYeastName().equals(str)){
						callback.promptCallback(item, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptYeastGen(final String title, final String body, final Context context
			, final ArrayList<YeastGen> items, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final YeastGen item : items){
			list.add(item.getDisplayString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final YeastGen item : items){
					if(item.getDisplayString().equals(str)){
						callback.promptCallback(item, 0, 0, "", type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}

	/***********************************************************************************************
	 * Prompts for enumeration items.
	 ***********************************************************************************************/
	/***********************************************************************************************
	 * Code for prompting Unit String.
	 * @param title
	 * @param body
	 * @param context
	 * @param type
	 ************************************************************************************************/
	public void promptUnitString(final String title, final String body, final Context context, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, Units.getComboBoxData());
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				callback.promptCallback(null, 0, 0, str, type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptUnitDubInt(final String title, final String body, final Context context, final PromptType type
			, final String iVal, final String dVal1, final int iSet, final double dSet1){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final LinearLayout layout = new LinearLayout(context);
		layout.setOrientation(LinearLayout.VERTICAL);
		
		final TextView spText = new TextView(context);
		spText.setText("Unit(s)");
		layout.addView(spText);
		
		final Spinner spinner = new Spinner(context);
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, Units.getComboBoxData());
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		layout.addView(spinner);

		final TextView tv1 = new TextView(context);
		tv1.setText(iVal);
		layout.addView(tv1);
		
		final EditText et1 = new EditText(context);
		et1.setText(Integer.toString(iSet));
		layout.addView(et1);
		
		final TextView tv2 = new TextView(context);
		tv2.setText(dVal1);
		layout.addView(tv2);
		
		final EditText et2 = new EditText(context);
		et2.setText(Double.toString(dSet1));
		layout.addView(et2);
		
		
		builder.setView(layout);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				final double dvalue = Double.parseDouble(et2.getText().toString().trim());
				final int ivalue = Integer.parseInt(et1.getText().toString().trim());
				callback.promptCallback(null, dvalue, ivalue, str, type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}

	public void promptMashType(final String title, final String body, final Context context, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> items = new ArrayList<String>();
		for(final MashType mt : MashType.values()){
			items.add(mt.toString());
		}
		
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, items);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				callback.promptCallback(null, 0, 0, str, type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}

	public void promptCaskType(final String title, final String body, final Context context, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> items = new ArrayList<String>();
		for(final Cask cask : Cask.values()){
			items.add(cask.toString());
		}
		
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, items);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				callback.promptCallback(null, 0, 0, str, type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}

	public void promptLabResults(final String title, final String body, final Context context, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> items = new ArrayList<String>();
		for(final LabResult rs : LabResult.values()){
			items.add(rs.toString());
		}
		
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, items);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				final int idx = LabResult.getResultByName(str);
				callback.promptCallback(null, 0, idx, str, type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}

	public void promptEquipmentType(final String title, final String body, final Context context, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> items = new ArrayList<String>();
		for(final EquipType et : EquipType.values()){
			items.add(et.toString());
		}
		
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, items);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				final int idx = EquipType.getEquipTypeByName(str);
				callback.promptCallback(null, 0, idx, str, type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}

	public void promptPitchType(final String title, final String body, final Context context, final PromptType type){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> items = new ArrayList<String>();
		for(final PitchType pt : PitchType.values()){
			items.add(pt.toString());
		}
		
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, items);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		
		builder.setView(spinner);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				final int idx = PitchType.getTypeByName(str).getType();
				callback.promptCallback(null, 0, idx, str, type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	
	/**********************************************************************
	 * Multiple Item Prompts
	 * @param title
	 * @param body
	 * @param context
	 * @param type
	 * @param iVal
	 * @param dVal1
	 * @param dVal2
	 * @param iSet
	 * @param dSet1
	 * @param dSet2
	 ***********************************************************************/
	public void promptIntDubDub(final String title, final String body, final Context context, final PromptType type
			, final String iVal, final String dVal1, final String dVal2, final int iSet
			, final double dSet1, final double dSet2){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final LinearLayout layout = new LinearLayout(context);
		layout.setOrientation(LinearLayout.VERTICAL);
		
		final TextView tv1 = new TextView(context);
		tv1.setText(iVal);
		layout.addView(tv1);
		
		final EditText et1 = new EditText(context);
		et1.setText(Integer.toString(iSet));
		layout.addView(et1);
		
		final TextView tv2 = new TextView(context);
		tv2.setText(dVal1);
		layout.addView(tv2);
		
		final EditText et2 = new EditText(context);
		et2.setText(Double.toString(dSet1));
		layout.addView(et2);
		
		final TextView tv3 = new TextView(context);
		tv3.setText(dVal2);
		layout.addView(tv3);
		
		final EditText et3 = new EditText(context);
		et3.setText(Double.toString(dSet2));
		layout.addView(et3);
		
		builder.setView(layout);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				List<Double> dList = new ArrayList<Double>();
				dList.add(Double.parseDouble(et2.getText().toString().trim()));
				dList.add(Double.parseDouble(et3.getText().toString().trim()));
				final int ivalue = Integer.parseInt(et1.getText().toString().trim());
				callback.promptCallback(dList, 0, ivalue, "", type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}

	public void promptDubDub(final String title, final String body, final Context context, final PromptType type
			, final String dVal1, final String dVal2, final double dSet1, final double dSet2){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final LinearLayout layout = new LinearLayout(context);
		layout.setOrientation(LinearLayout.VERTICAL);
		
		final TextView tv2 = new TextView(context);
		tv2.setText(dVal1);
		layout.addView(tv2);
		
		final EditText et2 = new EditText(context);
		et2.setText(Double.toString(dSet1));
		layout.addView(et2);
		
		final TextView tv3 = new TextView(context);
		tv3.setText(dVal2);
		layout.addView(tv3);
		
		final EditText et3 = new EditText(context);
		et3.setText(Double.toString(dSet2));
		layout.addView(et3);
		
		builder.setView(layout);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				List<Double> dList = new ArrayList<Double>();
				dList.add(Double.parseDouble(et2.getText().toString().trim()));
				dList.add(Double.parseDouble(et3.getText().toString().trim()));
				callback.promptCallback(dList, 0, 0, "", type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
	
	public void promptWarehouseAndString(final String title, final String body, final Context context
			, final ArrayList<Warehouse> warehouses, final PromptType type, final String sPrompt){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final LinearLayout layout = new LinearLayout(context);
		layout.setOrientation(LinearLayout.VERTICAL);
		
		final TextView tv2 = new TextView(context);
		tv2.setText(sPrompt);
		layout.addView(tv2);
		
		final EditText et2 = new EditText(context);
		et2.setText("");
		layout.addView(et2);
		
		final Spinner spinner = new Spinner(context);
		
		List<String> list = new ArrayList<String>();
		for(final Warehouse warehouse : warehouses){
			list.add(warehouse.getDisplayString());
		}
		ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
				android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner.setAdapter(dataAdapter);
		layout.addView(spinner);
		
		builder.setView(layout);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				final String str = spinner.getSelectedItem().toString();
				for(final Warehouse warehouse : warehouses){
					if(warehouse.getDisplayString().equals(str)){
						final String name = et2.getText().toString();
						callback.promptCallback(warehouse, 0, 0, name, type);
					}
				}
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}

	public void promptStrStrStrPass(final String title, final String body, final Context context, final PromptType type
			, final String dVal1, final String dVal2, final String dVal3, final String dVal4){
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(body);
		
		final LinearLayout layout = new LinearLayout(context);
		layout.setOrientation(LinearLayout.VERTICAL);
		
		final TextView tv1 = new TextView(context);
		tv1.setText(dVal1);
		layout.addView(tv1);
		
		final EditText et1 = new EditText(context);
		layout.addView(et1);
		
		final TextView tv2 = new TextView(context);
		tv2.setText(dVal2);
		layout.addView(tv2);
		
		final EditText et2 = new EditText(context);
		layout.addView(et2);
		
		final TextView tv3 = new TextView(context);
		tv3.setText(dVal3);
		layout.addView(tv3);
		
		final EditText et3 = new EditText(context);
		layout.addView(et3);
		
		final TextView tv4 = new TextView(context);
		tv4.setText(dVal4);
		layout.addView(tv4);
		
		final EditText et4 = new EditText(context);
		et4.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
		layout.addView(et4);
		
		builder.setView(layout);

		builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void onClick(DialogInterface dialog, int which) {
				List<String> sList = new ArrayList<String>();
				sList.add(et1.getText().toString().trim());
				sList.add(et2.getText().toString().trim());
				sList.add(et3.getText().toString().trim());
				sList.add(et4.getText().toString().trim());
				callback.promptCallback(sList, 0, 0, "", type);
			}
		});

		builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.cancel();
			}
		});
		
		builder.show();
	}
}
